package cn.zjk.springframework.context.support;

import cn.zjk.springframework.beans.factory.support.DefaultListableBeanFactory;
import cn.zjk.springframework.beans.factory.xml.XmlBeanDefinitionReader;

/**
 * 处理关于 XML 文件配置信息的操作
 * @author zjk
 * @CreateTime 2023/3/27 23:27
 */
public abstract class AbstractXmlApplicationContext extends AbstractRefreshableApplicationContext{
    @Override
    protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) {
        XmlBeanDefinitionReader beanDefinitionReader = new XmlBeanDefinitionReader(beanFactory,this);
        String[] configLocations = getConfigLocations();
        if(null!=configLocations){
            beanDefinitionReader.loadBeanDefinitions(configLocations);
        }
    }

    /**
     * 为了从入口上下文类，拿到配置信息的地址描述
     * @return
     */
    protected abstract String[] getConfigLocations();


}
